import { S } from '../../s';
import { IPSApplication } from '../ipsapplication';
import { IPSAppDEField } from '../dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSAppWF } from './ipsapp-wf';
import { IPSAppWFDE } from './ipsapp-wfde';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppWFDEImpl extends PSModelObjectImpl implements IPSAppWFDE {
  get entityWFState(): string {
    return this.M.entityWFState;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return;
    }
    const ipsapplication = this.getParentPSModelObject(
      S._26e,
    ) as IPSApplication;
    if (ipsapplication != null) {
      this.psappdataentity = ipsapplication.findPSAppDataEntity(value);
    }
    return this.psappdataentity;
  }

  protected psappwf: IPSAppWF;
  getPSAppWF(): IPSAppWF | null {
    if (this.psappwf != null) return this.psappwf;
    const value = this.M.getPSAppWF;
    if (value == null) {
      return;
    }
    const ipsapplication = this.getParentPSModelObject(
      S._26e,
    ) as IPSApplication;
    if (ipsapplication != null) {
      this.psappwf = ipsapplication.findPSAppWF(value);
    }
    return this.psappwf;
  }

  protected wfstatepsappdefield: IPSAppDEField;
  getWFStatePSAppDEField(): IPSAppDEField | null {
    if (this.wfstatepsappdefield != null) return this.wfstatepsappdefield;
    const value = this.M.getWFStatePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.wfstatepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.wfstatepsappdefield;
  }
  get cls(): string {
    return 'PSAppWFDEImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3a3) return true;
    return super.instanceof(cls);
  }
}
